import request from '@/utils/request';

// 查看审批步骤
export function loockFlow() {
    return request({
        url: '/approval_flow/show/',
        method: 'get',
    })
}

// 修改审批步骤
export function updataFlow(data) {
    return request({
        url: '/approval_flow/modify/',
        method: 'post',
        data:{
            approval_flow:data
        }
    })
}

// 查询危险源
export function querySource(data) {
    return request({
        url: '/source_of_danger/my_submit/',
        method: 'get',
        params:{
            start_time:data.startTime,
            end_time:data.endTime,
            type:data.type,
            size:data.size,
            page:data.page.pageNum
        }
    })
}

// 创建危险源
export function createSource(data) {
    return request({
        url: '/source_of_danger/',
        method: 'post',
        data: data
    })
}

// 查看我提交的危险源详情
export function sourceDetails(id) {
    return request({
        url: `/source_of_danger/${id}/my_submit_detail/`,
        method: 'get',
    })
}

// 修改危险源
export function updateSource(id,data) {
    return request({
        url: `/source_of_danger/${id}/`,
        method: 'put',
        data: data
    })
}

// 删除危险源
export function delSource(id) {
    return request({
        url: `/source_of_danger/${id}/`,
        method: 'delete'
    })
}

// 查看我的审批列表
export function queryApprovalList(data) {
    return request({
        url: '/source_of_danger/my_approve/',
        method: 'get',
        params:{
            start_time:data.startTime,
            end_time:data.endTime,
            type:data.type,
            size:data.size,
            page:data.page.pageNum,
            section_id:data.sectionId   
        }
    })
}

// 查看我审批的危险源详情
export function approveDetails(id) {
    return request({
        url: `/source_of_danger/${id}/my_approve_detail/ `,
        method: 'get',
    })
}

// 审批危险源
export function ApprovalSource(id,data) {
    return request({
        url: `/source_of_danger/${id}/approve/`,
        method: 'post',
        data:data
    })
}